package com.example.user;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    @Value("${openvsx.webui.url}")
    String webUrl;

    @GetMapping("/getUserById/{id}")
    public String getUser(@PathVariable("id") Long id){
        System.out.println("收到请求：");
        System.out.println(id);
        return userService.fetchUser(id);
    }

    @GetMapping("/test")
    public String test(){
        return userService.test();
    }

    @GetMapping("/getWebUrl")
    public String getWebUrl(){
        return webUrl;
    }
}
